{extend name="../template/parent.html" /}
{block name="personage"}
<script>
    jQuery(".topNav").slide({
        type: "menu", //效果类型
        titCell: "dd", // 鼠标触发对象
        targetCell: "ul", // 效果对象，必须被titCell包含
        delayTime: 0, // 效果时间
        defaultPlay: false,  //默认不执行
        returnDefault: true // 返回默认
    });
</script>

<script type="text/javascript" src="/static/index/js/jquery.validate.js"></script>
<script type="text/javascript" src="/static/index/js/address.js"></script>
<script type="text/javascript" src="/static/index/js/yworder.js"></script>
<script>
    var virtual = '0';
    var type = 'fast_buy'
</script>
<div class="cart-area-header">
    <div class="x-wrap">
        <script>
            //$("#com-header").attr("style","background:transparent url('http://xtep.oss-cn-hangzhou.aliyuncs.com/guanwang/2016/02/gwnew2016-banner.jpg') no-repeat scroll center center;");
        </script>
        <!--<a href="/" class="logo"><img src="http://xtep.oss-cn-hangzhou.aliyuncs.com/guanwang/2017/2/9/logo.png"></a>-->

        <a href="http://www.xtep.com.cn/"><img src="/static/index/images/LOGO.png"></a>
        <p>
            <i class="one">1</i><i class="two">2</i><i class="three">3</i> <span class="one">选择商品</span><span
                class="two">确认订单信息</span><span class="three">成功提交订单</span>
        </p>
    </div>
</div>
<div class="x-wrap">
    <div class="cart-info-list cart-info-item">
        <div id="address_div">


            <h3>
                <span>|</span>地址选择
            </h3>
            <ul class="addr-list">

                <li class="addr-item current" id="consignee_261763" data="261763">
                    <p>{$addressData['names']} <a href="javascript:;" onclick="defaultAddr(261763);" class="addr-default">选择设为默认</a> <span
                            class="addr-defaulted">默认地址</span>
                    </p>
                    <p >
                        {$addressData['names']} </p>
                    <p class="addr-detail" > {$addressData['address'][0]} {$addressData['address'][1]} {$addressData['address'][2]}  </p>
                    <span class="addr-operation"><a  class="change">修改</a> <a class="addr-revise">删除</a></span> <i class="sed-icon"></i>
                </li>


                <li class="add-addr" ><i class="sed-icon"></i> <span>添加新地址</span>
                </li>

            </ul>
            <div class="addr-ctr" id="bu_address" style="display: none">
                <form method="post" id="addressForm" name="addressForm" action="/orders/do_index">
                    <input type="hidden" name="address_first" value="1">
                    <input type="hidden" name="address_id" id="address_id" value="261763">
                    <div class="cart-info-item">
                        <div>
                            <label ><span class="c-red asterisk">*</span>收货人</label> <input id="touser" name="consignee" type="text" value="{$addressData['names']}" style="background-image: url(&quot;&quot;); background-repeat: no-repeat; background-attachment: scroll; background-size: 16px 18px; background-position: 98% 50%; cursor: auto;">
                            <label id="checkconsignee"  style="color: red"></label>
                        </div>
                        <div>
                            <label ><span class="c-red asterisk">*</span>所在地区</label>
                            <div id="city">
                                <select class="prov"></select>
                                <select class="city" disabled="disabled"></select>
                                <select class="dist" disabled="disabled"></select>
                            </div>
                        </div>
                        <div>
                            <label  ><span class="c-red asterisk">*</span>详细地址</label>
                            <textarea id="dizhi" name="address" type="text">{$addressData['address'][2]}</textarea>

                        </div>
                        <div>
                            <b class="textf00"> </b><span></span><label id="checkzipcode"  style="color: red"></label>
                        </div>
                        <div>
                            <label  ><span class="c-red asterisk">*</span>手机号</label>
                            <input maxlength="11" id="phones" name="phone" class="flow_text_box " type="text" value="{$addressData['tel']}">
                            <!--      <label class="num-alert">两者至少填一项</label> <label id="checkphone" for="phone" style="color: red;width:160px;"></label>-->
                        </div>
                        <div>
                            <!--			<label   class=""><span class="c-red asterisk">*</span>或电话号码</label>-->
                            <!--		            <input id='tel01' name='tel01' class="area --><!--" type="text" size="4" style="width:40px;" maxlength="4" value="--><!--"/>-->
                            <!--					<label style="width: 3px">-</label><input id='tel02' name='tel02' class="numbers --><!--" type="text" size="8"  style="width:80px;" maxlength="8" value="--><!--"/>-->
                            <!--					<label style="width: 3px">-</label><input id='tel03' name='tel03' class="extension --><!--" type="text" size="8" style="width:80px;" maxlength="8"  value="--><!--"/>-->

                        </div>
                        <!-- 		<div> -->
                        <!-- 			<label   class="c-red"></label> <input type="checkbox"	class="default-addr"><span>设为默认地址</span>  -->
                        <!-- 		</div> -->
                        <div>
                            <label for=></label> <input type="submit" onclick="submituser()" value="保存收货信息" class="save-btn">
                        </div>
                    </div>
                </form>



            </div>
        </div>
        <div class="cart-info-item">
            <h3>
                <span>|</span>配送信息
            </h3>
            <div class="postage">
                <b>全场免邮<i class="sed-icon"></i></b> <input type="hidden" name="shipping_id" value="40">
                <p>
                    （配送费用：¥0.00 / 配送物流：EMS、圆通、申通、中通、汇通、韵达；）<br>
                    由于货品在不同的仓库，我们仓库同事会根据您的地址为您发最为便捷的物流，不接受指定快递。
                </p>
            </div>
        </div>
        <div class="cart-info-item">
            <h3>
                <span>|</span>支付方式
            </h3>
            <div class="pay">
                <!--<a href="javascript:;" class="current" onclick="selectPayment(this)" data="1" pay_code="alipay" is_cod="0" title=" 支付宝网站(www.alipay.com) 是国内先进的网上支付平台。"><img src="/static/index/images/pay_zhifubao.gif" alt=""><i class="sed-icon"></i></a>-->
                <a href="javascript:;" onclick="selectPayment(this)" data="127" pay_code="weixin" is_cod="0" title=" 只要是有银联标识的银行卡或信用卡都可以" class=""> <img src="/static/index/images/pay_wechat.png" alt=""><i class="sed-icon"></i></a>
                <input type="hidden" value="127" id="pay_id">
                <script>$(function () {
                    $(".pay a[data='127']").click();
                });</script>
            </div>
        </div>
        <div class="cart-info-item">
            <h3>
                <span>|</span>确认订单信息
            </h3>
            <table class="x-cart-table">
                <thead>
                <tr>
                    <td width="480" style="text-align: center;">商品信息</td>
                    <td width="150">颜色尺寸</td>
                    <td width="130">单价（元）</td>
                    <td width="130">数量</td>
                    <td width="130">小计（元）</td>
                </tr>
                </thead>
                <tbody>
                {if condition="session('cart') "}
                {foreach $data['goods'] as $k=>$v}
                <tr id="ma" sid="{$k}">
                    <td><img src="/{$v.options.img}" alt="">
                        <p> {$v.name}</p></td>
                    <td>颜色: {$v.options.color} 尺码: {$v.options.size}码</td>
                    <td>{$v.price}</td>
                    <td>{$v.num}</td>
                    <td>¥{$v.total}</td>
                </tr>
                {/foreach}
                {/if}
                </tbody>
            </table>
            <div class="user-cart">
                <div class="label-box fl">
                    <label >添加备注：</label>
                </div>
                <div class="label-box fl">
                    <textarea id="memo" name="remark" type="text" style="height: 70px; border: 1px solid #CCC; width: 380px; background-color: #FFF; overflow: hidden;"></textarea>
                </div>
                <a href="{:url('index/cart/index')}" class="return-cart fr">返回修改购物车</a>
            </div>

            <input id="integration_pay_rate" value="0.20" type="hidden">
            <input id="rate" value="0.01" type="hidden">
            <input id="user_points" value="0" type="hidden">

            <div class="user-cart">
                <div class="discount-box">
                    <a href="javascript:;" class="coupons-title"><i></i>使用优惠券</a>
                    <div class="coupons-box">
                        <p>
                            此订单暂无可用的优惠券。 您可以<a href="javascript:;">查看所有优惠券</a>了解使用限制。 <a
                                href="javascript:;">[了解特步优惠券规则]</a>
                        </p>
                        <p>
                            <label >请选择本次可使用抵用券：</label><select id="user_vouchers">
                            <option value="0">-未选择-</option>
                        </select><a href="javascript:;" class="use-btn" >使用</a>
                        </p>
                    </div>
                    <!-- 						2 -->
                    <a href="javascript:;" class="coupons-title"><i></i>使用积分</a>
                    <div class="coupons-box">
                        <h4>
                            <input type="checkbox" name="use_integration" chk="0" id="use_integration" value="" onclick="misun_integral(0,0.01,0);">本次可抵用积分<span class="c-red">(0) </span>可抵扣 ¥0 </h4>
                        <p>您的账户暂无积分</p>
                    </div>


                </div>
            </div>
            <div class="user-cart">
                <div class="total-box fr">
                    <p>
                        <label><b class="c-red">1</b>件商品总金额：</label>
                        ¥<span id="baseprice" class="c-red">{$data['total_price']}</span>
                    </p>
                    <p>
                        <label>运费：¥</label> <span class="c-red">0.00</span>
                    </p>
                    <p>
                        <label>优惠券：¥</label><span class="c-red" id="total_use_vouchers">0.00</span>
                    </p>
                    <p style="display:none;">
                        <label>积分抵现：¥</label><span class="c-red" id="total_use_integral">0.00</span>
                    </p>
                    <p style="display:none;">
                        <label>余额抵用：¥</label><span class="c-red" id="total_use_balance">0.00</span>
                    </p>
                    <!-- 					<p> -->
                    <!-- 						<label>可获得积分：</label> <span class="c-red">777</span> -->
                    <!-- 					</p> -->

                </div>
            </div>
            <div class="cart-total">
                <span>实付款：</span>
                <b class="c-red" id="must_pay">{$data['total_price']} </b>元 <a id="ordersub"  href="javascript:;" title="提交订单">提交订单</a>
            </div>
        </div>
    </div>
</div>
<script type="text/javascript" src=""></script>
<!--<script type="text/javascript" src="/static/index/js/city.min.js"></script>-->

<script type="text/javascript" src="/static/index/js/jquery.cityselect.js"></script>

<script>
    $("#ordersub").click(function(){
        var data = {
            sid: $('#ma').attr('sid'),
            price: $('#must_pay').text(),
            memo:$('#memo').val(),
        };
        $.post("{:url('index/order/orderajax')}",data,function(res){
           if(res ==1)
           {
               location.href="{:url('index/pay/index')}"
           }
        },'json')


    });
    $('.change').click(function(){

        $('#bu_address').css('display','block');
    });
    $('.sed-icon').click(function(){

        $('#bu_address').css('display','block');
    });


    $(function(){
        $("#city").citySelect({
            nodata:"none",
            prov:"{$addressData['address'][0]}",
            city:"{$addressData['address'][1]}",
            dist:"{$addressData['address'][2]}",
            required:false
        });
    });
    function submituser() {
//        alert(1);
        var data = {
            user: $('#touser').val(),
            phone:$('#phones').val(),
            sheng:$('.prov').val(),
            shi:$('.city').val(),
            qu:$('.dist').val(),
            dizhi:$('#dizhi').val(),


        };
        $.post("{:url('index/order/addresajax')}",data,function(res){
//            layer.tips(res.message, '#reg_user');
        },'json')
    };

</script>
{/block}